//
//  HLIMKitConfig.m
//  YueYue
//
//  Created by hulu001 on 2024/1/11.
//

#import "HLIMKitConfig.h"
#import "HLIMKitMessageSetting.h"
#import <NIMSDK/NIMMessage.h>

@implementation HLIMKitConfig

- (instancetype)init
{
    self = [super init];
    
    if (self) {
        _leftMessageSettings = [[HLIMKitMessageSettings alloc] init:NO];
        _rightMessageSettings = [[HLIMKitMessageSettings alloc] init:YES];
        _nickFont = [UIFont systemFontOfSize:12];
        _nickColor = [UIColor colorWithRed:144/255.0 green:144/255.0 blue:144/255.0 alpha:1.0];
        _limitMessageCount = 1000;
        _cornerRadius = 38;
        _messageCellClass = @"HLIMKitMesssageCell";
        _inputbarClass = @"HLIMKitInputBar";
        _msgReadColor = [UIColor colorWithRed:168/255.0 green:171/255.0 blue:185/255.0 alpha:1.0];
        _msgUnReadColor = [UIColor colorWithRed:148/255.0 green:106/255.0 blue:250/255.0 alpha:1.0];
        _msgReadFont = [UIFont systemFontOfSize:12];
        _timeColor = [UIColor colorWithRed:205/255.0 green:208/255.0 blue:211/255.0 alpha:1.0];
        _timeFont = [UIFont systemFontOfSize:12];
        _showMessageTimeInterval = 1 * 5 * 60; // 如果时间戳精确到毫秒 最后要 *1000
    }
    
    return self;
}

- (HLIMKitMessageSetting *)setting:(NIMMessage *)message
{
    HLIMKitMessageSettings *settings = message.isOutgoingMsg? self.rightMessageSettings : self.leftMessageSettings;
    switch (message.messageType) {
        case NIMMessageTypeText:
            return settings.textSetting;
        case NIMMessageTypeImage:
            return settings.imageSetting;
        case NIMMessageTypeLocation:
            return settings.unsupportSetting;
        case NIMMessageTypeAudio:
            return settings.audioSetting;
        case NIMMessageTypeVideo:
            return settings.videoSetting;
        case NIMMessageTypeFile:
            return settings.fileSetting;
        case NIMMessageTypeTip:
            return settings.tipSetting;
        case NIMMessageTypeRtcCallRecord:
            return settings.videochatSetting;
        case NIMMessageTypeNotification:
        {
            NIMNotificationObject *object = (NIMNotificationObject *)message.messageObject;
            switch (object.notificationType)
            {
                case NIMNotificationTypeNetCall:
                    return settings.videochatSetting;
                default:
                    break;
            }
            break;
        }
        default:
            break;
    }
    return settings.unsupportSetting;
}


@end
